package com.sun.demo.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.stereotype.Component;

/**
 * /actuator/info展示内容
 */
@Component
public class AppVersionInfo implements InfoContributor {

    @Value("${pom.projectName}")
    private String projectName;

    @Value("${pom.version}")
    private String appVersion;

    @Override
    public void contribute(Info.Builder builder) {
        builder.withDetail("projectName", projectName)
                .withDetail("version", appVersion)
                .withDetail("description", "This is a simple Spring Boot application.");
    }

}
